package com.three.digit.tools;

public class MortgageCal {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		System.out.println(calculate(280000, 0.068d, 0.85d, 20));
	}

	/**
	 * 
	 * @param total 贷款总额 单位元
	 * @param lv 贷款利率
	 * @param percent 折扣
	 * @param years 贷款时间单位年
	 * @return
	 */
	public static double calculate(int total, double lv, double percent,
			int years) {

		lv = lv * percent / 12;
		double l = 1d + lv;
		double t = 1d;
		t = t * Math.pow(l, 12 * years);
		return total * lv * t / (t - 1d);
	}

}
